<%-- 
    Document   : videogames
    Created on : 15-mag-2013, 9.38.08
    Author     : Giuseppe
--%>

<%@page import="ejb.ArticoloNuovo"%>
<%@page import="ejb.ArticoloUsato"%>
<%@page import="java.util.List"%>
<%@page import="ejb.Utente"%>
<%@page import="java.util.*"%>
<%@include file="wrapper.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<style type="text/css">
.aggiungi {
width: 85px;
float: left;
padding-top: 5px;
text-align: right;
}
</style>
<%
    Utente utSession = (Utente)session.getAttribute("utente");
    String tipo = utSession.getTipo();
    List<ArticoloUsato> usatiDaConfermare= (List<ArticoloUsato>)session.getAttribute("usatiDaConfermare");
    %>
<div class="container">
   <div class="row-fluid">
        <div class="span3 bs-docs-sidebar">
            <ul class="nav nav-list bs-docs-sidenav">
               <li><a href="Controller?button=visualizzaArticoli&typeView=All"> 
                <button class="btn btn-large btn-inverse btn-block"><i class="icon-white icon-th-list"></i> Tutti gli Articoli</button> </a></li>
                <li><a href="Controller?button=modificaCancellaArtNuovi"> 
                <button class="btn btn-large btn-inverse btn-block"><i class="icon-white icon-th-list"></i> Articoli Nuovi</button> </a></li>
                <li><a href="Controller?button=modificaCancellaArtUsati&confirm=n"> 
                <button class="btn btn-large btn-inverse btn-block"><i class="icon-white icon-th-list"></i> Articoli Usati</button> </a></li>
                <li><a href="Controller?button=articoloNuovo"> 
                <button class="btn btn-large btn-inverse btn-block"><i class="icon-white icon-plus"></i> Aggiungi Art. Nuovo</button> </a></li>
            </ul>
        </div>   
        <div class="span6">   
            <div class="thumbnail">   
            <h3>Elenco Articoli usati</h3>
             <form action="Controller" method="POST">
                <table class="table table-hover">
                <%
                List<ArticoloUsato> artUsati= (List<ArticoloUsato>)session.getAttribute("listArticleUsed");
                for(ArticoloUsato a:artUsati){  
                %>  
                <tr>
                   <% if(tipo.equals("a")){%>
                    <td style="width:210px"><%=a.getNome()%></td> 
                    <% if(usatiDaConfermare.contains(a)){%>
                    <td> <a href="Controller?button=confermaArtUsato&id=<%=a.getId()%>"> <button class="btn btn-success btn-small" type="button" style="width:95px"><i class="icon-white icon-ok"></i> Conferma</button>  </a> </td> 
                    <%}else{%>
                        <td> <a href="Controller?button=modificaArtUsato&id=<%=a.getId()%>"> <button class="btn btn-inverse btn-small" type="button" style="width:95px"><i class="icon-white icon-wrench"></i> Modifica</button>  </a> </td> 
                    <%}%>
                        <td> <a href="Controller?button=cancellaArtUsato&id=<%=a.getId()%>&idUser=<%=utSession.getId()%>"> <button class="btn btn-inverse btn-small" type="button" style="width:95px"><i class="icon-white icon-trash"></i> Cancella</button>  </a> </td> 
                <%}%>
                </tr>
                <%}%>
                </table>
             </form>
            </div>
        </div>
    <div class="span3">
  
      <% if(tipo.equals("a")){%>
            <div class="thumbnail">
                 <p><b>Notes</b></p>
                 <br>
                 <% if(!usatiDaConfermare.isEmpty()){%>
                    <p> Ancora <%=usatiDaConfermare.size()%> articoli da confermare </p>
                    <br>
                    <p align="center">
                        <a href="Controller?button=modificaCancellaArtUsati&amp;confirm=s">
                            <button class="btn btn-inverse btn-small"><i class="icon-white icon-th-list"></i> Vedi Articoli da confermare</button>
                        </a>
                    </p>
                 <%}else{%>
                 <p> Nessun articolo da confermare </p>
                <%}
            }%>      
            </div>
   </div>
</div>
</div>

</body>